<template>
	<view class="content">
		<view class="list" v-for="(item,index) in pageResult.list" :key="index" >
			<view class="title">
				<view class="name"> {{item.username}}<text class="mobile">({{item.usermobile}})</text></view>
				<view class="time"> {{item.date}} </view>
			</view>
			<view class="preferential" v-for="(log,index2) in item.logList" :key="index2" v-if="item.logList.length > 0">
				<view class="preferential-title"> {{log.title}} </view>
				<view class="preferential-num"> {{log.content}} </view>
			</view>
			<view class="viceTile"> {{item.remark}} </view>
		</view>
	</view>
</template>

<script>
	var _self;
	import serve from '../static/request.js';
	import storage from '../static/appkey.js';
	import common from '../static/jump.js';
	export default {
		data() {
			return {
				pageParam: {
					appkey: uni.getStorageSync('appkey'),
					'access-token': uni.getStorageSync('access-token'),
					date: '',
					type: '',
					itemId: 0,
					page: 0,
				},
				pageResult: {
					list: [],
					isEmpty: false,
					isEnd: false
				},
				id: 0,

			}
		},
		methods: {
			getList(){
				uni.showLoading({
					title: '加载中···',
					mask: true
				});
				_self.pageParam.page++
				serve.request({
					url: '/spread/index/detail',
					data: _self.pageParam
				}).then(res => {
					console.log(res.data); 
					if (res.data && res.data.length > 0) {
						_self.pageResult.list=_self.pageResult.list.concat(res.data);
					}
					_self.pageResult.isEmpty = _self.pageResult.list.length == 0;
					_self.pageResult.isEnd = res.data.length == 0; 
					uni.hideLoading();
				});
			},
			jump(jump_type, jump_link) {
				common.jump(jump_type, jump_link)
			},
			
		},
		onLoad(options) {
			_self = this;
			_self.pageParam.date = options.date || '';
			_self.pageParam.type = options.type || '';
			_self.pageParam.itemId = options.itemId || '';
			_self.getList();
		},
		onPullDownRefresh() {
			this.pageParam.page=0;
			this.pageResult.list=[];
			this.getList();
		},
		onReachBottom() {
			if(this.pageResult.isEnd ||this.pageResult.isEmpty){
				return
			}
			this.getList()
		}
	}
</script>

<style scoped>
	page, .content{
		height: auto;
		background: #fff;
		color: #333;
		padding: 0 14rpx;
	}
	.list{
		margin-top: 20rpx;
		background: #f1f1f1;
		border-radius: 8rpx;
		padding: 12rpx 20rpx;
	}
	.title{
		display: flex;
		justify-content: space-between;
		align-items: center;
		/* height: 70rpx; */
		padding: 18rpx 0;
		font-size: 32rpx;
		border-bottom: 1rpx solid #b3b3b3;
	}
	.name{
		flex: 6;
	}
	.mobile{
		font-size: 30rpx;
		color: #3d3d3d;
		padding-left: 6rpx;
	}
	.time{
		flex: 2;
	}
	.preferential{
		display: flex;
		padding: 16rpx;
		align-items: center;
		justify-content: space-between;
		font-size: 27rpx;
	}
	.preferential-title{}
	.preferential-calculate{}
	.preferential-num{}
	.viceTile{
		padding: 16rpx 0 0 0;
		font-size: 28rpx;
		line-height: 1.6;
		border-top: 1rpx solid #b3b3b3;
	}

</style>
